home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #2
/
Amiga Plus CD - 2004 - No. 02.iso
/
AmiSoft
/
Util
/
conv
/
IFF2rexx.lha
/
IFF2rexx.rexx
< prev
Wrap
OS/2 REXX Batch file
|
2004-01-19
|
1KB
|
29 lines
/* $VER: IFF2rexx 1.0 $
* Convert IFF data to rexx source
* © by Stefan Haubenthal 2004 */
if ~open(iff,arg(1)) then exit 0*writeln(stdout,"Usage: IFF2rexx ifffile")
if readch(iff,4)~=FORM then exit 10+0*writeln(stdout,"Error: This is not an IFF file")
say '/* Generated by 'word(sourceline(1),3)' V'word(sourceline(1),4)' */'
say 'call open(iff,"'substr(arg(1),max(lastpos(":",arg(1)),lastpos("/",arg(1)))+1)'",W)'
say 'call writech(iff,"FORM")'
len=c2d(readch(iff,4))
say 'call writech(iff,d2c('len',4))'
type=readch(iff,4)
say 'call writech(iff,"'type'")'
do forever
chunk=readch(iff,4)
if eof(iff) then leave
say 'call writech(iff,"'chunk'")'
len=c2d(readch(iff,4))
say 'call writech(iff,d2c('len',4))'
do len%8 while ~eof(iff)
data=readch(iff,8)
say 'call writech(iff,"'c2x(data)'"x) /* 'translate(data,,xrange(,'1f'x))' */'
end
data=readch(iff,len//8)
say 'call writech(iff,"'c2x(data)'"x) /* 'translate(data,,xrange(,'1f'x))' */'
data=readch(iff,len//2)
if len//2 then say 'call writech(iff,"00"x) /* pad */'
end